﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RelationExpertSystem.Relation
{
    public class Sibling : RelationBase
    {
        private static Sibling _singleton = new Sibling();
        public static Sibling Instance
        {
            get { return _singleton; }
        }

        private Sibling() { }

        public override bool IsRelated(Person a, Person b)
        {
            // b is a's sibling IFF a's mother is b's mother and a's father is b's father
            return a.Father == b.Father && a.Mother == b.Mother;
        }

        public override IEnumerable<IRelation> GetDependencies()
        {
            return new HashSet<IRelation>(new IRelation[] { Mother.Instance, Father.Instance });
        }
    }
}
